/*kZime*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <cstdlib>
#include <algorithm>
#define MAXN 1000000
using namespace std;
inline int read() {
	int k = 0, f = 1; char c = getchar();
	for(; !isdigit(c); c = getchar())if(c == '-') f = -1;
	for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
	return k * f;
}
/*-----------------------------------------------------------------------------*/

struct f{
	int p, w;
}fl[MAXN];
int n, m;

bool cmp(f a, f b) {
	return a.w < b.w;
}

int main() {
#ifndef MYLAB
	freopen("haoi13_t2.in", "r", stdin);
	freopen("haoi13_t2.out", "w", stdout);
#else
	freopen("in.txt", "r", stdin);
#endif

	n = read();
	m = read();
	
	for(int i = 0; i < n; i++) {
		fl[i].w = read(); 
		fl[i].p = read();
	}

	sort(fl, fl + n, cmp);
	
	int s = 0, i = 0, ans = 0;
	while(s <= m && i < n) {
		int temp = fl[i].p * fl[i].w; 
		if(temp + s < m) {
			s += temp;
			ans += fl[i].p;
			i++;
		}
		else {
			ans += (m - s) / fl[i].w;
			break;
		}
	}

	printf("%d", ans);

	return 0;
}

